Repository navigation
Export only the modules on the runtime classpath - #771
Open
piercifani wants to merge 2 commits into
Open
piercifani wants to merge 2 commits into
piercifani wants to merge 2 commits into
Conversation
skipstone wires SkipUnit as testImplementation/androidTestImplementation, so no exported module depends on it at runtime. Exporting it anyway put a test library into consumers' release builds without its dependencies (JUnit, androidx.test, TestParameterInjector), which R8 reports as missing classes. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…g SkipUnit Ask Gradle for the exported module's <variant>RuntimeClasspath and copy only the AARs of that module and the project modules it resolves. Test-only modules such as SkipUnit, which skipstone wires as testImplementation/androidTestImplementation, are left out without naming them. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
In library mode,
skip exportcopies the AAR of every module in the generated Gradle project. That includes test-only modules such as SkipUnit, which skipstone wires only astestImplementation/androidTestImplementation(seeSkipstoneCommand.swift), so no exported module needs it at runtime.Exported AARs carry no dependency metadata. So a consumer that adds every exported AAR to its app gets SkipUnit in release builds without SkipUnit's own dependencies (JUnit, androidx.test, and since SkipUnit 1.8.2 TestParameterInjector). Because the default ProGuard rules keep
skip.**, R8 then fails with missing classes, for example:Before 1.8.2, the same problem showed up as missing JUnit classes, which consumers had to silence with
-dontwarn.Change
For each variant, ask Gradle for the exported module's
<variant>RuntimeClasspath(gradle -q :Module:dependencies --configuration debugRuntimeClasspath). Then copy only the AARs of that module and the project modules it resolves.This needs no module names in the export: what counts as test-only is decided once, by the dependencies skipstone generates. App-mode export is unaffected because it builds the APK through Gradle project dependencies. The extra Gradle call takes about 0.6s per variant with the Gradle daemon already running.
Validation
Ran
skip init --transpiled-modelfor a library that depends on SkipFoundation, thenskip export(debug and release):DemoLib,SkipFoundation,SkipLib, andSkipUnitAARs.DemoLib,SkipFoundation, andSkipLibAARs, for both variants.skip/unit/.Related: skiptools/skip-unit#29 and #770 take a different approach, moving the parameterized-test runner into Android test fixtures. This change removes the need for that on the export path.
🤖 Generated with Claude Code